import unittest, os
from django.test import TestCase
from django.test.client import Client
from django.conf import settings
from models import *

class StaticManagerTest(TestCase):
    fixtures = ['test_data',]

    def test_static(self):
        directory = os.path.join(settings.WEB_ROOT, 'fooo','bar')
        if not os.path.exists(directory):
            os.makedirs(directory)
        filename =  os.path.join(directory, 'index.html')
        open(filename, 'w').write('testing')
        client = Client()
        client.get('/admin/')
        from django.contrib.auth.models import User
        foo = User(username='bar', email='jason@foobar.com')
        foo.set_password('foobar')
        foo.save()
        self.failIf(os.path.exists(filename))
